package com.controller;


import com.entity.PostingLike;
import com.service.PostingLikeService;
import com.vo.ResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 点赞控制器
 *
 * @author lbb
 * @version 1.0
 * @date 2020.3.3
 */
@RestController
@RequestMapping("/api")
public class PostingLikeController {
	
	@Autowired
	private PostingLikeService postingLikeService;
	
	/**
	 * 点赞
	 * @param postingLike 点赞信息
	 * @return
	 */
	@PostMapping("/postingLike/add")
	public ResponseVO addPostingLike(@RequestBody PostingLike postingLike) {
		postingLikeService.addPostingLike(postingLike);
		ResponseVO vo = new ResponseVO();
		vo.setCode("200");
		return vo;
	}

	/**
	 * 取消点赞
	 * @param postingLike 点赞信息
	 * @return
	 */
	@PostMapping("/postingLike/del")
	public ResponseVO delPostingLike(@RequestBody PostingLike postingLike) {
		postingLikeService.delPostingLike(postingLike);
		ResponseVO vo = new ResponseVO();
		vo.setCode("200");
		return vo;
	}
}
